package org.obis.portal.ws.action;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.obis.portal.ws.model.SpeciesDistributionRecord;
import org.springframework.jdbc.core.RowMapper;

/**
 * A simple factory class for an SDR based on a SQL resultset
 * @author tim
 */
public class SpeciesDistributionRecordRowMapper implements RowMapper {
	@Override
	public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
		SpeciesDistributionRecord sdr = new SpeciesDistributionRecord();
		sdr.setId(rs.getLong("id"));
		sdr.setScientificName(rs.getString("scientificname"));
		sdr.setLatitude(rs.getDouble("latitude"));
		sdr.setLongitude(rs.getDouble("longitude"));
		sdr.setResFullName(rs.getString("resfullname"));
		return sdr;
	}

}
